﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="StoreWeb.system.userManage.edit" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../../lib/html5.js"></script>
<script type="text/javascript" src="../../lib/respond.min.js"></script>
<script type="text/javascript" src="../../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>添加用户</title>
</head>
<body>
    <div class="pd-20">
        <form runat="server" method="post" class="form form-horizontal" id="formmemberadd">
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>用户名称：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="" id="username" name="username" runat="server" datatype="*1-50" nullmsg="用户名称不能为空">
                </div>
                 <div class="col-4"> </div>
            </div>
           
            <div class="row cl">
                <label class="form-label col-2">登录名：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="" id="loginname" name="loginname" runat="server">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-2">登录密码：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="" id="password" name="password" runat="server">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-2">手机：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="" id="mobile" name="mobile" runat="server">
                </div>
            </div>
            
            <div class="row cl">
                <label class="form-label col-2">邮箱：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="" id="email" name="email" runat="server">
                </div>
            </div>

           <div class="row cl">
                <label class="form-label col-2">角色：</label>
                <div class="formControls col-6">
                    <asp:DropDownList ID="ddlrole" runat="server" Width="200" class="input-text" nullmsg=""></asp:DropDownList>
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-2">备注：</label>
                <div class="formControls col-6">
                    <%--<input type="text" class="input-text" value="" placeholder="" id="description" name="description" runat="server">--%>
                    <asp:TextBox ID="description" placeholder="" runat="server" class="input-text" TextMode="MultiLine" Height="60px"  ></asp:TextBox>
                 </div>
            </div>
            

            <div class="row cl">
                <label class="form-label col-2">所属经销商：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" style="width:200px" value="" placeholder="" id="selsectdealers" name="user-tel" runat="server"  readonly>
                    <input type="hidden" id="dealers" value="" runat="server">
                   <%-- <input type="submit" name="btnok" value="选择上级" id="btnok" class="btn btn-success radius" onclick="admin_role_add('上级经销商', 'adduser.aspx', '560px', '400px')" />--%>
                    <a title="选择经销商" href="javascript:;" onclick="admin_role_add('所属经销商', 'adduser.aspx', '560px', '400px')" class="btn btn-success radius">选择经销商 </a>
                </div>
            </div>


            <div class="row cl">
                <div class="col-10 col-offset-2">
                    <asp:HiddenField ID="hidid" runat="server" />
                    <asp:Button ID="btn_ok" runat="server" CssClass="btn btn-success radius" Text="确定" />
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../../lib/Validform/5.3.2/Validform.min.js"></script>
    <script type="text/javascript" src="../../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/H-ui.js"></script>
    <script type="text/javascript" src="../../js/H-ui.admin.js"></script>
    <script type="text/javascript" src="../../js/area.js"></script>
    <script>
        _init_area();
    </script>
    <script>
        function admin_role_add(title, url, w, h) {
            //layer_show(title, url, w, h);
            layer.open({
                type: 2,
                title: title,
                area: [w, h],
                content: url,
                success: function () {
                    var $input = $('#selsectdealers');
                    var $hidden = $('#dealers');
                    $adduser = layer.getChildFrame('#myTable a.adduser');
                    $adduser.click(function () {
                        var $this = $(this);
                        $input.val($this.data('text'));
                        $hidden.val($this.data('id'))
                        layer.closeAll();
                    });
                }
            });
        }
        $(function () {
            $("#formmemberadd").Validform({
                tiptype: 2,
                btnSubmit: "#btn_ok",
                beforeSubmit: function (curform) {
                    //alert($("#dealers").val());  
                    $.post("../../ajax/userManage.aspx", { username: $("#username").val(), loginname: $("#loginname").val(), password: $("#password").val(), mobile: $("#mobile").val(), email: $("#email").val(), role: $("#ddlrole").val(), description: $("#description").val(), dealersid: $("#dealers").val(), id: $("#hidid").val() },
                    function (data) {
                        if (data == 1) {
                            parent.layer.alert("添加成功", function () {
                                parent.location.reload();
                            });
                        } else if (data == 2) {
                            parent.layer.alert("修改成功", function () {
                                parent.location.reload();
                            });
                        } else {
                            parent.layer.msg("操作失败");
                        }
                    });
                    return false;
                }
            });
        });
    </script>
</body>
</html>
